﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using ICSharpCode.AvalonEdit.Document;

namespace iopt.solvency.pillarone.client.desktop.Converters
{
    public class DocumentConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return new TextDocument();
            }
            if (string.IsNullOrEmpty(value.ToString()))
            {
                return new TextDocument();
            }

            return new TextDocument(value.ToString());
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
